/* Copyright 2009 Requirements Management System 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.mags.remas.model.entity.provider;

// Generated Jan 19, 2010 2:33:54 PM by Hibernate Tools 3.2.2.GA
// powered by MAGS

import java.io.Serializable; 
import org.mags.dao.provider.CacheableDataProvider;
import org.mags.remas.model.entity.KeyType;

public class KeyTypeProvider extends CacheableDataProvider<KeyType> {
	private static final long serialVersionUID = 1L;
	public KeyType getENUM() {
		return this.getByName("ENUM");
	}
	public boolean isENUM(KeyType keyType) {
		return (keyType.getKeyTypeId()==getENUM().getKeyTypeId());
	}
	public KeyType getDATE() {
		return this.getByName("DATE");
	}
	public boolean isDATE(KeyType keyType) {
		return (keyType.getKeyTypeId()==getDATE().getKeyTypeId());
	}
	public KeyType getVARCHAR(){
		return this.getByName("VARCHAR");
	}
	public boolean isVARCHAR(KeyType keyType) {
		return (keyType.getKeyTypeId()==getVARCHAR().getKeyTypeId());
	}
	public KeyType getFLOAT() {
		return this.getByName("FLOAT");
	}
	public KeyType getINTEGER() {
		return this.getByName("INTEGER");
	}
	public KeyType getLIST() {
		return this.getByName("LIST");
	}
	public boolean isLIST(KeyType keyType) {
		return (keyType.getKeyTypeId()==getLIST().getKeyTypeId());
	}
	public boolean isFLOAT(KeyType keyType) {
		return (keyType.getKeyTypeId()==getFLOAT().getKeyTypeId());
	}
	public boolean isINTEGER(KeyType keyType) {
		return (keyType.getKeyTypeId()==getINTEGER().getKeyTypeId());
	}
	public KeyType getByName(String name) {
		for(KeyType i: this.getAll())
			if(i.getName().equalsIgnoreCase(name))
				return i;
		return null;
	}
	public KeyType getById(Serializable id) {
		for(KeyType i: this.getAll())
			if(i.getKeyTypeId()==((Short)id).shortValue())
				return i;
		return null;
	}
	protected void loadProperties(KeyType one) {
	}
}
